package util;

import java.util.concurrent.locks.ReentrantReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock;
import java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock;

public class Storage<T> {
	
	private T value;
	private final ReentrantReadWriteLock readWriteLock;
	private final ReadLock readLock;
	private final WriteLock writeLock;
	
	public Storage(T value) {
		this.setValue(value);
		readWriteLock = new ReentrantReadWriteLock();
		readLock = readWriteLock.readLock();
		writeLock = readWriteLock.writeLock(); 
	}

	public T getValue() {
		return value;
	}

	public void setValue(T value) {
		this.value = value;
	}

	public ReadLock getReadLock() {
		return readLock;
	}

	public WriteLock getWriteLock() {
		return writeLock;
	}
	

}
